package com.progress.bar;

import java.util.Timer;
import java.util.TimerTask;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.widget.Toast;

public class serviceclass extends Service {

	LocalBinder binder;
	Context cxt;
	Timer time;
	int counter = 0;
	public void onCreate() {
		super.onCreate();
		time = new Timer();
		binder = new LocalBinder();
		cxt = this;
	}

	public void onStart(Intent intent, int startId) {
		TimerTask task = new TimerTask() {
		public void run() {
			Toast.makeText(cxt, ("Service has counted " + Integer.toString(counter * 5000)), Toast.LENGTH_SHORT);//???
			counter += 1;
		}
	};
		super.onStart(intent, startId);
		time.schedule(task, 0, 5000);
	}

	public void onDestroy() {
		super.onDestroy();
	} 
	
	public class LocalBinder extends Binder {
		serviceclass getService() {
			return (serviceclass.this);
		}
	}
	
	@Override
	public IBinder onBind(Intent intent) {
		return(binder);
	}

}
